

package swing1;
import javax.swing.*;


public class Main {

    private static void createAndShowGUI() {
        JFrame frame = new JFrame("Calculadora");
        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        frame.getContentPane().setLayout(new java.awt.GridLayout(3,4));
        JButton boton1 = new JButton("7");
        JButton boton2 = new JButton("8");
        JButton boton3 = new JButton("9");
        JButton boton4 = new JButton("+");

        JButton boton5 = new JButton("4");
        JButton boton6 = new JButton("5");
        JButton boton7 = new JButton("6");
        JButton boton8 = new JButton("-");

        JButton boton9 = new JButton("1");
        JButton boton10 = new JButton("2");
        JButton boton11 = new JButton("3");
        JButton boton12 = new JButton("0");

        frame.add(boton1);
        frame.add(boton2);
        frame.add(boton3);
        frame.add(boton4);
        
        frame.add(boton5);
        frame.add(boton6);
        frame.add(boton7);
        frame.add(boton8);
        
        frame.add(boton9);
        frame.add(boton10);
        frame.add(boton11);
        frame.add(boton12);

        frame.pack();
        frame.setVisible(true);
        
    }
    public static void main(String[] args) {
        SwingUtilities.invokeLater(new Runnable()  {
            public void run(){
                createAndShowGUI();
            }
        });
    }
}
